/*
 * Copyright (c) 2009. Silenus Consultoria, S.L.
 */
package es.silenus.detecta.dao;

import java.util.List;


/**
 * Page interface for result pagination.
 *
 * @author <a href="mailto:malonso@silenus-consultoria.es">Mariano Alonso</a>
 * @since 02-abr-2009 0:53:59
 */
public interface Page<T> {
	/**
	 * Retrieves the start offset.
	 *
	 * @return the start offset.
	 */
	public int getStart();

	/**
	 * Sets the start offset.
	 *
	 * @param start the start offset.
	 */
	public void setStart(int start);

	/**
	 * Retrieves the limit or page size.
	 *
	 * @return the limit or page size.
	 */
	public int getLimit();

	/**
	 * Sets the limit or page size.
	 *
	 * @param limit the limit or page size.
	 */
	public void setLimit(int limit);

	/**
	 * Adds a sort field criteria.
	 *
	 * @param field the field.
	 * @param direction the sort direction: ASC / DESC.
	 */
	public void addSort(final String field, final String direction);

	/**
	 * Retrieves the results of this page.
	 *
	 * @return the results of this page.
	 */
	public List<T> getResults();

	/**
	 * Retrieves the total results.
	 *
	 * @return the total results.
	 */
	public int getTotal();

	/**
	 * Performs pagination. It is implementation specific.
	 */
	public void paginate();
}
